//
//  MagicLensMainWindow.m
//  MagicLens
//
//  Created by Tianzhou on 09-3-1.
//  Copyright 2009 Tianzhou Software Inc.. All rights reserved.
//

#import "MagicLensMainWindow.h"


@implementation MagicLensMainWindow

- (id)initWithContentRect:(NSRect)contentRect styleMask:(unsigned int)aStyle backing:(NSBackingStoreType)bufferingType defer:(BOOL)flag 
{
	//Call NSWindow's version of this function, but pass in the all-important value of NSBorderlessWindowMask
    //for the styleMask so that the window doesn't have a title bar
    NSWindow* result = [super initWithContentRect:contentRect styleMask:NSTexturedBackgroundWindowMask backing:NSBackingStoreBuffered defer:flag];
    //Set the background color to clear so that (along with the setOpaque call below) we can see through the parts
    //of the window that we're not drawing into
	[result setBackgroundColor: [NSColor colorWithCalibratedWhite:0.0 alpha:0.0]];
    //This next line pulls the window up to the front on top of other system windows.  This is how the Clock app behaves;
    //generally you wouldn't do this for windows unless you really wanted them to float above everything.
    //Let's start with no transparency for all drawing into the window
    //but let's turn off opaqueness so that we can see through the parts of the window that we're not drawing into
    [result setOpaque:NO];
    //and while we're at it, make sure the window has a shadow, which will automatically be the shape of our custom content.
    [result setHasShadow: YES];
	
	//[result setAcceptsMouseMovedEvents:YES];
	
    return result;
}

- (BOOL)canBecomeKeyWindow
{
    return YES;
}

- (BOOL)canBecomeMainWindow
{
	return YES;
}


@end
